package com.pucong.gitee.database.backup.business.service.util.cmdOs;

import com.pucong.gitee.database.backup.common.entity.service.SSHConnectInfo;
import com.pucong.gitee.database.backup.common.entity.service.dto.ServiceComputerContnectTestDto;

import javax.websocket.Session;

/**
 * @Description: WebSSH的业务逻辑
 * @Author: NoCortY
 * @Date: 2020/3/7
 */
public interface WebSSHService {
    /**
     * @Description: 初始化ssh连接
     * @Param:
     * @return:
     * @Author: NoCortY
     * @Date: 2020/3/7
     * @param session
     */
    public void initConnection(javax.websocket.Session session);

    /**
     * 测试连接
     * @param dto
     * @return
     */
    public Boolean connectTest(ServiceComputerContnectTestDto dto);


    /**
     * @Description: 处理客户段发的数据
     * @Param:
     * @return:
     * @Author: NoCortY
     * @Date: 2020/3/7
     */
    public void recvHandle(String buffer, Session session);


    /**
     * 数据写回前端 for websocket
     * 处理rz、sz命令，java实现全网唯一
     * @param sshConnectInfo
     * @param session
     * @param buffer
     * @param count
     * @Author: pucong
     * @Date: 2022/02/02
     */
    public void sendMessage(SSHConnectInfo sshConnectInfo, javax.websocket.Session session, byte[] buffer, int count);


    /**
     * @Description: 关闭连接
     * @Param:
     * @return:
     * @Author: NoCortY
     * @Date: 2020/3/7
     */
    public void close(javax.websocket.Session session);
}